home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 332_01 / initscr.c < prev    next >
C/C++ Source or Header  |  1990-01-05  |  2KB  |  62 lines

  1. /****************************************************************/
  2. /* Initscr() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*                Bjorn Larsson (bl@infovox.se)    */
  10. /****************************************************************/
  11. /* 1.4:  Use of short wherever possible. Portability        */
  12. /*     improvements:                    900114    */
  13. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /* 1.2:     Rcsid[] string for maintenance:        881002    */
  15. /* 1.1:     Revision string in the code:            880306    */
  16. /* 1.0:     Release:                    870515    */
  17. /****************************************************************/
  18.  
  19. #include <curses.h>
  20. #include <curspriv.h>
  21.  
  22. char _curses_initscr_rcsid[] = "@(#)initscr.c    v.1.4  - 900114";
  23. char _curses_revcod[] =  CURSES_RCS_ID;
  24. char _curses_cpyrgt[] = "Author B. Larsson - Public Domain";
  25.  
  26. extern    void    exit();        /* to avoid warings */
  27.  
  28. WINDOW *curscr;            /* the current screen image */
  29. WINDOW *stdscr;            /* the default screen window */
  30. cursv   _cursvar;        /* curses variables */
  31. int    LINES;            /* terminal height */
  32. int    COLS;            /* terminal width */
  33.  
  34. /****************************************************************/
  35. /* Initscr() does neccessary initializations for the PCcurses    */
  36. /* package. It MUST be called before any other curses routines.    */
  37. /****************************************************************/
  38.  
  39. int initscr()
  40.   {
  41.   _cursvar.cursrow   = -1;        /* Initial cursor unknown */
  42.   _cursvar.curscol   = -1;
  43.   _cursvar.autocr    = TRUE;        /* lf -> crlf by default */
  44.   _cursvar.raw       = FALSE;        /* tty I/O modes */
  45.   _cursvar.cbreak    = FALSE;
  46.   _cursvar.echo      = TRUE;
  47.   _cursvar.refrbrk   = FALSE;        /* no premature end of refresh */
  48.   _cursvar.orgcbr    = (bool)_cursesgcb();/* original ^BREAK setting */
  49.  
  50.   LINES              = 25;        /* this ought to be fixed */
  51.   COLS               = _cursesgcols();
  52.  
  53.   if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  54.     exit(1);
  55.   if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  56.     exit(1);
  57.   if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  58.     exit(1);
  59.   curscr->_clear = FALSE;
  60.   return(OK);
  61.   } /* initscr */
  62.